import grails.test.*;
import Event
/**
 * Created by IntelliJ IDEA.
 * User: Robin
 * Date: Apr 26, 2009
 * Time: 9:33:18 PM
 * To change this template use File | Settings | File Templates.

 */
public class EventControllerTests extends ControllerUnitTestCase{

    protected void setup(){
                      super.setUp()
    }

    protected void teardown(){
        super.tearDown()
    }

  void testShow() {

          Event expectedEvent = new Event(name: "Pizza Party", description: "Drunken devils", location: "Home", administrator: null, startDate: new Date(), endDate: new Date() +1)
          mockDomain(Event, [expectedEvent])
          controller.params.id = 1
          assertNotNull(controller)
          assertNotNull(controller.params)
          assertNotNull(controller.params.id)
          Map model = controller.show()
          assertEquals(expectedEvent, model.eventInstance)
}


  void testUpdate(){

	        Event event = new Event(name: "Pizza Party", description: "Drunken devils", location: "Home", administrator: null, startDate: new Date(), endDate: new Date() +1)
	        mockDomain(Event, [event])
            event.save()
            controller.params.id = event.id
	        controller.params.name  = "KEEP PLAYING"
	        controller.update()
            assertEquals("KEEP PLAYING" ,Event.get(event.id).name)
  }
}
